package com.catmiw.swt;

import com.catmiw.wyz.util.FileUtils;

public class TestLoadAllWords implements NetFileGetter {
	private static String filename = "D:\\studyassist\\config\\dd.txt";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new TestLoadAllWords().run();
	}

	private int threadcount = 0;
	int count = 0;
	EnglishWordsXmlHandler xml=new EnglishWordsXmlHandler(
			"D:/studyassist/config/englishwords.xml");
	private void run() {
		String c = FileUtils.getTextFile(filename, "GBK");
		String[] s = c.split(System.getProperty("line.separator"));
		while (count < s.length) {
			if (threadcount < 10) {
				System.out.println(s[count]+"\t"+threadcount);
				new Thread(new EnglishWordNetLoader(s[count++],
						"D:/studyassist/英语mp3/",xml ,this)).run();
				threadcount++;
			} else {
				try {
					Thread.sleep(100);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
	}

	public void afterLoad(boolean success) {
		threadcount--;
		System.out.println(count);
	}

}
